# -*- coding:utf-8 -*-
from pydantic import Field
from sqlalchemy import Column, Integer, String, DateTime, Enum, DECIMAL, Float, TEXT
from core.curd import Base, TimestampMixin
from pydantic import BaseModel


class SysPost(Base, TimestampMixin):
    """
    测试表
    """
    __tablename__ = 'sys_post'

    id = Column(Integer, nullable=False, autoincrement=True, primary_key=True, comment='id')
    post_code = Column(String(100), comment='岗位编码')
    post_name = Column(String(100), comment='岗位名称')
    sort = Column(Integer, comment='排序')
    status = Column(Integer, comment='状态  0：停用   1：正常')
    tenant_id = Column(Integer, comment='租户ID')
    version = Column(Integer, comment='版本号')
    deleted = Column(Integer, comment='删除标识  0：正常   1：已删除')
    creator = Column(Integer, comment='创建者')
    updater = Column(Integer, comment='更新者')


class CreateSysPost(BaseModel):
    post_code: str = Field(comment='岗位编码', max_length=100)
    post_name: str = Field(comment='岗位名称', max_length=100)
    sort: int = Field(comment="排序", default=0)
    status: str = Field(comment="状态 0 停用 1正常", min_length=1, max_length=2)


class UpdateSysPost(BaseModel):
    id: int = Field(comment='id')
    post_code: str = Field(comment='岗位编码', max_length=100)
    post_name: str = Field(comment='岗位名称', max_length=100)
    sort: int = Field(comment="排序", default=0)
    status: str = Field(comment="状态 0 停用 1正常", min_length=1, max_length=2)
